package cn.edu.xjtu.data_structure.chapter01_linearlist.linkedlist;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/9/9 21:05
 */
public class LinkedListTest {
    public static void main(String[] args) {
        //测试单链表
        LinkedList<Integer> list = new LinkedList<>();//默认构造最多10个元素
        list.print();//打印空表
        list.insert(1);
        list.insert(4);
        list.insert(2);
        list.insert(5);
        list.insert(3);
        list.insert(0);
        list.insert(2);//插入元素
        System.out.println("after insert: ");
        list.print();
        list.setPosition(2);
        list.remove();
        System.out.println("delete the third element:");
        list.print();
        list.setFirst();
        System.out.println("set first");
        list.setValue(7);
        System.out.println("change the current element from "+list.currValue()+" to 7:");
        list.print();
    }
}
